<%= turbo_frame_tag :cart_summary do %>
  <% if order.item_count.positive? %>
    <div class="cart-summary-container p-4">
      <p class="text-center lg:text-right text-sm mb-3">
        <%= Spree.t('storefront.cart.shipping_and_taxes_calculated_at_checkout') %>
      </p>

      <div class="shopping-cart-total-text text-center lg:text-right uppercase font-medium">
        <%= Spree.t(:total) %>
        <span class="shopping-cart-total-amount">
          <%= order.display_item_total %>
        </span>
      </div>

      <% unless order.cart_promo_total.zero? %>
        <div class="shopping-cart-total-text mt-3 text-center lg:text-right uppercase font-medium">
          <%= Spree.t(:promotion) %>
          <span class="shopping-cart-total-amount">
            <%= order.display_cart_promo_total %>
          </span>
        </div>
      <% end %>
      <div class="flex <%= !turbo_frame_request? && !turbo_stream_request? ? 'flex-row' : 'flex-col' %> gap-4 mt-4 w-full justify-end items-end">
        <% if quick_checkout_enabled?(@order) %>
          <div class="min-h-[46px] w-full has-[turbo-frame]:block group no-separator">
            <% if !turbo_frame_request? && !turbo_stream_request? %>
              <%= render partial: 'spree/checkout/quick_checkout', locals: { height: 46, theme: 'black', button_width: 320, container_class: "w-full flex justify-end" } %>
            <% else %>
              <%= render partial: 'spree/checkout/quick_checkout', locals: { height: 46, theme: 'white', max_columns: 2, max_rows: 2 } %>
            <% end %>
          </div>
        <% end %>
        <div class="flex flex-col gap-4 <%= 'w-full' if turbo_frame_request? || turbo_stream_request? %>">
          <%= link_to Spree.t(:checkout), spree.checkout_path(order.token),
          class: 'btn-primary block w-full lg:w-80 text-center !no-underline !mt-0',
          data: { 'turbo': 'false', 'cart-target': 'checkoutButton' } %>
        </div>
      </div>
    </div>
  <% end %>
<% end %>
